/*
 * decoder.h
 *
 *  Created on: 2011-09-22
 *      Author: willion
 */

#ifndef __DECODER_H__
#define __DECODER_H__

#include "dbclass.h"

#include <string>
#include <iostream>

class decoder
{
public:

	decoder();

	virtual ~decoder();

	bool show_coin(std::string cipher_txt, int _num, int thres);

	char char_shift(char c, int shift);

	void show_key(std::string cipher_txt, int len);

	void decrypt(std::string cipher_txt, std::string key, int size = 0, std::ostream& output = std::cout);

	unsigned char remap(unsigned char cipher, unsigned char key);
	char vermap(unsigned char cipher, char plaintext);

	void guess_ascill_key(std::string cipher_text, int len);

	void plaintext_attack(std::string cipher_file, mysqlpp::sql_bigint id, int len, std::string plaintext);

	bool char_validation(unsigned char c);

//private:

		dbclass db;

		char order[16];
		char reverse_order[16];

		char matrix[16][16];

};

#endif /* DECODER_H_ */
